<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>patiet update</title>
        
        <link href="calendar.css" rel="stylesheet" type="text/css" />
        <link href="validate.css" rel="stylesheet" type="text/css" />
        <script src="calendar.js" ></script>
        <script src="validate.js"></script>        
    </head>

    <body>
        
        <%@page import="java.sql.*,java.io.*,sai.mysql.DriverLoading" %>
            <%!                
                Statement state;
                ResultSet result;
                String userid;
                String url;
                String pid, uid, pat_name, fa_name, dob, email, address, mobile,status;
            %>
    <center><br><font size="7">Patient Updation Form</font>
        <form name="pupdate" id="pupdate" method="post" onsubmit="return validate(this)" action="./patientupdate">
            <table border="0">
                 <%
                try {
                    DriverLoading dl = new DriverLoading();
                    state=dl.getStatement();
                    userid = request.getParameter("username");
                    url = "select PATIENT_ID,USERID,PATIENT_NAME,FATHER_NAME,DOB,EMAIL,MARTIAL_STATUS,ADDRESS,MOBILE from `patient` where userid='" + userid + "'";
                    result = state.executeQuery(url);
                    boolean b = result.next();
                    if (b) {
                        pid = result.getString(1);
                        uid = result.getString(2);
                        pat_name = result.getString(3);
                        fa_name = result.getString(4);
                        dob = result.getString(5);
                        email = result.getString(6);
                       status= result.getString(7);
                        address = result.getString(8);  
                          mobile  = result.getString(9);
                    }
                    else{
                        RequestDispatcher rd = request.getRequestDispatcher("patientupdateerror.html");
                        rd.forward(request, response);
                    }

                } catch (SQLException e) {
                    out.println("Sql exception raised: . ." + e);
                } catch (Exception e) {
                    out.println("Exception raised  . . " + e);
                }
            %>
            <tr>                 
                    <td><input  type="hidden" name="pid" id="pid" value=<%=pid%> /></td>                    
                </tr>
                
                <tr> 
                    <td> <font size="4"><b><font color="red">*</font>PatientName </b></font> </td> 
                    <td><input  type="text" name="pname" id="pname" value=<%=pat_name%> /></td>
                    <td rowspan="2"><img src="" height="130" width="120">	</td>
                </tr>			

                <tr> 
                    <td> <font size="4"><b><font color="red">*</font>FatherName </b></font> </td> 
                    <td><input  type="text" name="fname" id="fname" value=<%=fa_name%> /></td>
                </tr>


                <tr> 
                    <td> <font size="4"><b><font color="red">*</font>Gender </b></font> </td> </tr>
                <tr>
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                        <strong><input type="radio" name="gender" id="gender" value="male" checked/>male</strong></td>
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <strong><input type="radio" name="gender" value="female" id="gender"/>female</strong></td>
                </tr>

 
                <tr> 
                    <td> <font size="4"><b><font color="red">*</font>DOB </b></font> </td> 
                    <td><a name="a"><input  type="text" name="dob" value=<%=dob%> /></a></td>			 
                </tr>

                <tr> <td> <font size="4"><b><font color="red">*</font>username </b></font> </td> 
                    <td><input  type="text" name="username" id="username" value=<%=uid%>  /></td>
                    <td><div id="id1">Please enter user name</div></tr>


                <tr> <td> <font size="4"><b><font color="red">*</font>Password</b></font></td> 
                    <td><input  type="password" name="password" id="password"/></td>
                </tr> 

                <tr> <td> <font size="4"><b><font color="red">*</font>Re-enter Password </b></font> </td> 
                    <td><input  type="password" name="repassword" id="repassword"/></td></tr>
                <tr>
                    <td> <font size="4"><b><font color="red">*</font>Address</b></font></td>
                    <td><textarea rows=5 cols=15 name="address" id="address"  ><%=address%></textarea></td>
                </tr>
                <tr> <td> <font size="4"><b><font color="red">*</font>EmailId </b></font> </td> 
                    <td><input  type="text" name="email" id="email" maxlength="50" value=<%=email%> /></td></tr>
                <tr> <td> </td><td> </td></tr>

                <tr> <td> <font size="4"><b><font color="red">*</font>Contact no . </b></font> </td> 
                    <td><input  type="text" name="mobile" id="mobile" maxlength="13" value=<%=mobile%> /></td></tr>
                <tr> <td> </td><td> </td></tr>               

                <tr> 
                    <td><font size="4"><b><font color="red">*</font>Martial Status </b></font> </td>
                    <td><select name="status">
                            <option ><b><font size="4">----please select----</font></b></option>
                            <option value="married"><b><font size="4">married</font></b></option>
                            <option value="Not Married"><b><font size="4">Not Married</font></b></option>
                        </select></td>
                </tr>	
               
                <tr>
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>

                    <td><input type="submit" name="update" value="Update" style="width:100px;margin-top:50px" /></td>
                </tr>			

            </table>
        </form>
    </center>
</body>
</html>

